package com.lzw.breezeNovel.webApp.controller.novel;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.webApp.service.novel.RatingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller
 * @date 2025/3/2
 * @description 评分的控制类
 */
@RestController
@RequestMapping("/app/rating")
@SuppressWarnings("all")
public class RatingController {

    /**
     * 注入RatingService
     */
    @Autowired
    private RatingService ratingService;

    /**
     * 对小说进行评分
     */
    @GetMapping("/rateBook")
    public Result rateBook(@RequestParam Long bookId, @RequestParam BigDecimal rating){
       ratingService.rateBook(bookId,rating);
       return Result.ok();
    }

}
